Cant import from other file

Ive got my .proto file with a message that can be exported -

syntax = "proto3";

package domain;

option go_package = "BITBUCKET-REPOSITORY-MANAGEMENT-SERVICE/internal/gRPC/domain";

message Repoistory{
    int64 id = 1;
    string name = 2;
    int64 userId = 3;
    bool isPrivate = 4;

And another .proto file that import the Repository from the other -

syntax = "proto3";

package service;

option go_package = "BITBUCKET-REPOSITORY-MANAGEMENT-SERVICE/internal/gRPC/service";

import "";

//RepositoryService Definition
service RepositoryService {
    rpc add (domain.Repository) returns (AddRepositoryResponse);

message AddRepositoryResponse {
    domain.Repository addedRepository = 1;
    Error error = 2;

message Error {
    string code = 1;
    string message = 2;

But unfortunatly, when i try to install it with -
protoc --go_out=. repository-service.proto
i get this error everytime - File not found.
repository-service.proto:7:1: Import “” was not found or had errors.
repository-service.proto:15:5: “domain.Repository” is not defined.
repository-service.proto:11:14: “domain.Repository” is not defined.

basically says that it cant find my file. Im really not sure whats wrong because ive checked the path so many times, and still cant see the issue

this is the path of the file im trying to import from


same error unfortunately


Hello Justin,

it would help readability by ensuring the code in your question is properly formatted.
To do so, add three back ticks immediately followed by “go” in front of the first code line and append three back ticks after the last line. The line must start with the back ticks.

This will yield a nice formatting of your code.


Are you sure the file name is repository.proto and there is no typo in it ?

It could be that the location where you execute the protoc command matters because the import path is relative.


the path to the file is -

and im executing the protoc command in the folder where the other file is


I’ve got so many files. i guess thats why im having such an issue


thanks. this path is better. mine was getting too complicated


This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.